<template>
  <div />
</template>

<script>
export default {
  created() {
    console.log(this.xxx(2))
  },
  methods: {
    xxx(value) {
      const aa = [
        {
          id: 1,
          value: '正式'
        },
        {
          id: 2,
          value: '非正式'
        }
      ]

      //   const cc = aa.findIndex(v => v.id === value)
      //   return cc !== -1 ? aa[cc].value : ''
      //   const cc = aa.filter(v => v.id === value)
      //   return cc[0].value

      let cc = ''
      aa.forEach(v => {
        if (v.id === value) {
          cc = v.value
        }
      })

      return cc
    }

  }

}
</script>

<style>

</style>
